﻿using System;
using System.IO;
using System.Collections.Generic;

using SBPweb.PROvibe.Client.Framework.Contracts.Parameters;
using SBPweb.PROvibe.Client.Framework.Utilities.Collections;

namespace SBPweb.PROvibe.Client.Framework.Actors.Parameters
{

    public class EntryInitializationParametersDictionary : OverridableDictionary<string, IEntryInitializationParameter>, IEntryInitializationParametersDictionary
    {

        public EntryInitializationParametersDictionary()
            : base()
        {
        }

        //public static string Serialize(IEntryInitializationParametersDictionary dictionary)
        //{
        //    string ret = string.Empty;
        //    foreach (KeyValuePair<string, IEntryInitializationParameter> kvp in dictionary)
        //    {
        //        ret += string.Format("{0}={1},", kvp.Key, EntryInitializationParameter.Serialize(kvp.Value));
        //    }
        //    return ret;
        //}

        public static IEntryInitializationParametersDictionary Deserialize(IDictionary<string, string> itemParams)
        {
            EntryInitializationParametersDictionary ret = new EntryInitializationParametersDictionary();
            foreach (KeyValuePair<string, string> kvp in itemParams)
            {
                IEntryInitializationParameter eip = EntryInitializationParameter.Deserialize(kvp.Value);
                if (eip != null)
                {
                    ret.Add(kvp.Key, eip);
                }
            }
            return ret;
        }

    }

}